home *** CD-ROM | disk | FTP | other *** search
- on mouseDown me
- set xCenter to ((the left of sprite 4 + the right of sprite 4) / 2) + 1
- set yCenter to ((the top of sprite 4 + the bottom of sprite 4) / 2) + 2
- set radius to the width of sprite 4 / 2
- set the cursor of sprite the spriteNum of me to [member "Closed Hand", member "Closed Hand Mask"]
- repeat while the stillDown
- set mx to the mouseH
- set my to the mouseV
- set xAtMouse to mx - xCenter
- set yAtMouse to my - yCenter
- if xAtMouse <> 0 then
- set angleAtMouse to atan(float(abs(yAtMouse)) / float(abs(xAtMouse)))
- if angleAtMouse = 0 then
- set yAtCircle to 0
- set xAtCircle to radius * (xAtMouse / abs(xAtMouse))
- else
- set yAtCircle to sin(angleAtMouse) * float(radius) * (yAtMouse / abs(yAtMouse))
- set xAtCircle to cos(angleAtMouse) * float(radius) * (xAtMouse / abs(xAtMouse))
- end if
- else
- set xAtCircle to 0
- if yAtMouse <> 0 then
- set yAtCircle to radius * (yAtMouse / abs(yAtMouse))
- else
- set yAtCircle to radius
- end if
- end if
- set the locH of sprite the clickOn to xCenter + xAtCircle
- set the locV of sprite the clickOn to yCenter + yAtCircle
- drawLine(6, yCenter, xCenter, the locV of sprite the clickOn, the locH of sprite the clickOn)
- set the locH of sprite 5 to ((the left of sprite 6 + the right of sprite 6) / 2) - 10
- set the locV of sprite 5 to ((the top of sprite 6 + the bottom of sprite 6) / 2) - 30
- set dy to float(yCenter - the locV of sprite the clickOn)
- set dy to -dy
- set dx to float(xCenter - the locH of sprite the clickOn)
- if dx = 0 then
- if dy < 0 then
- set theta1 to float(1.5 * PI)
- else
- set theta1 to float(PI / 2.0)
- end if
- else
- if dx > 0 then
- set theta1 to float(atan(float(dy / dx)))
- if theta1 < 0 then
- set theta1 to float(theta1) + (2.0 * PI)
- end if
- else
- set theta1 to float(atan(float(dy / dx))) + PI
- end if
- end if
- set the floatPrecision to 2
- if theta1 > PI then
- set theta1 to theta1 - PI
- else
- set theta1 to theta1 + PI
- end if
- set temp to theta1 * 180.0 / PI
- if temp = 360.0 then
- put "0.0" into field "theta"
- else
- put temp into field "theta"
- end if
- if dx <> 0 then
- put float(float(sqrt(2.0)) * float(cos(theta1))) into field "X1"
- else
- put "0.0" into field "X1"
- end if
- put float(float(sqrt(2.0)) * float(sin(theta1))) into field "Y1"
- if field "X1" = 0 then
- set the locH of sprite 26 to 486
- else
- set the locH of sprite 26 to 700
- end if
- put "(" & field "X1" & "," & field "Y1" & ")" into field "x-y"
- updateStage()
- end repeat
- set the cursor of sprite the spriteNum of me to [member "hand", member "Hand Mask"]
- end
-
- on beginSprite me
- set the cursor of sprite the spriteNum of me to [member "hand", member "Hand Mask"]
- put "19.12" into field "theta"
- put "0.48" into field "Y1"
- put "1.33" into field "X1"
- end
-
- on endSprite me
- set the cursor of sprite the spriteNum of me to 0
- end
-